# -*- coding:utf-8 -*-
# title           :
# description     :
# author          :Python超人/三月三提供
# date            :2024-07-06
# link            :https://gitcode.net/pythoncr/
# python_version  :3.9
# ==============================================================================
import os

from 神笔码靓.神笔库.神笔绘图板 import 神笔绘图板
from 神笔码靓.神笔库.定义集 import *
from 神笔码靓.神笔库.配置 import *
from 神笔码靓.神笔库.通用工具集 import *
from 神笔码靓.码靓库.共用.国家简码 import 国家简码


class 三原色绘图板(神笔绘图板):
    def __init__(self, 作品文件路径, 颜色1, 颜色2, 颜色3, 颜色12, 颜色23, 颜色31, 颜色123):
        self.颜色1, self.颜色2, self.颜色3, self.颜色12, self.颜色23, self.颜色31, self.颜色123 = \
            颜色1, 颜色2, 颜色3, 颜色12, 颜色23, 颜色31, 颜色123
        宽, 高 = 60, 60
        super(三原色绘图板, self).__init__(作品文件路径, 宽=宽, 高=高, 视图区=f"0 0 {宽} {高}")

    def 构建颜色路径1(self):
        return {
            "颜色1": [
                ("M", 41.18, 15.23),
                ("C", 41.18, 23.62, 34.39, 30.42, 26.00, 30.42),
                ("C", 17.61, 30.42, 10.82, 23.62, 10.82, 15.23),
                ("C", 10.82, 6.85, 17.61, 0.05, 26.00, 0.05),
                ("C", 34.39, 0.05, 41.18, 6.85, 41.18, 15.23),
                ("Z",), ],
            "颜色3": [
                ("M", 52.00, 34.83),
                ("C", 52.00, 43.21, 45.20, 50.01, 36.82, 50.01),
                ("C", 28.43, 50.01, 21.63, 43.21, 21.63, 34.83),
                ("C", 21.63, 26.44, 28.43, 19.64, 36.82, 19.64),
                ("C", 45.20, 19.64, 52.00, 26.44, 52.00, 34.83),
                ("Z",), ],
            "颜色23": [
                ("M", 22.42, 29.99),
                ("C", 23.57, 30.27, 24.77, 30.42, 26.00, 30.42),
                ("C", 32.69, 30.42, 38.38, 26.08, 40.40, 20.07),
                ("C", 39.25, 19.79, 38.05, 19.64, 36.82, 19.64),
                ("C", 30.12, 19.64, 24.44, 23.98, 22.42, 29.99),
                ("Z",), ],
            "颜色2": [
                ("M", 30.37, 34.83),
                ("C", 30.37, 43.21, 23.57, 50.01, 15.18, 50.01),
                ("C", 6.80, 50.01, 0.00, 43.21, 0.00, 34.83),
                ("C", 0.00, 26.44, 6.80, 19.64, 15.18, 19.64),
                ("C", 23.57, 19.64, 30.37, 26.44, 30.37, 34.83),
                ("Z",), ],
            "颜色12": [
                ("M", 11.60, 20.07),
                ("C", 13.62, 26.08, 19.31, 30.42, 26.00, 30.42),
                ("C", 27.23, 30.42, 28.43, 30.27, 29.58, 29.99),
                ("C", 27.56, 23.98, 21.88, 19.64, 15.18, 19.64),
                ("C", 13.95, 19.64, 12.75, 19.79, 11.60, 20.07),
                ("Z",), ],
            "颜色31": [
                ("M", 21.63, 34.83),
                ("C", 21.63, 38.98, 23.30, 42.74, 26.00, 45.48),
                ("C", 28.70, 42.74, 30.37, 38.98, 30.37, 34.83),
                ("C", 30.37, 30.68, 28.70, 26.91, 26.00, 24.17),
                ("C", 23.30, 26.91, 21.63, 30.68, 21.63, 34.83),
                ("Z",), ],
            "颜色123": [
                ("M", 29.58, 29.99),
                ("C", 28.43, 30.27, 27.23, 30.42, 26.00, 30.42),
                ("C", 24.77, 30.42, 23.57, 30.27, 22.42, 29.99),
                ("C", 23.16, 27.78, 24.40, 25.80, 26.00, 24.17),
                ("C", 27.60, 25.80, 28.84, 27.78, 29.58, 29.99),
                ("Z",), ],
        }

    def 构建颜色路径2(self):
        return {
            "颜色1": [
                ("M", 8.00, 1.40),
                ("A", 5.00, 5.00, 0, 0, 0, 5.51, 10.73),
                ("C", 5.51, 10.66, 5.50, 10.58, 5.50, 10.50),
                ("A", 5.00, 5.00, 0, 0, 1, 12.99, 6.17),
                ("A", 4.99, 4.99, 0, 0, 0, 8.00, 1.40),
                ("z",), ],
            "颜色2": [
                ("M", 10.50, 10.50),
                ("C", 10.50, 13.26, 8.26, 15.50, 5.50, 15.50),
                ("S", 0.50, 13.26, 0.50, 10.50),
                ("C", 0.50, 7.74, 2.74, 5.50, 5.50, 5.50),
                ("S", 10.50, 7.74, 10.50, 10.50),
                ("z",), ],
            "颜色3": [
                ("M", 12.99, 6.17),
                ("C", 12.99, 6.25, 13.00, 6.32, 13.00, 6.40),
                ("A", 5.00, 5.00, 0, 0, 1, 5.51, 10.73),
                ("A", 4.99, 4.99, 0, 0, 0, 10.50, 15.50),
                ("A", 5.00, 5.00, 0, 0, 0, 12.99, 6.17),
                ("z",), ],
            "颜色12": [
                ("M", 5.50, 5.50),
                ("C", 4.59, 5.50, 3.74, 5.75, 3.01, 6.17),
                ("A", 4.99, 4.99, 0, 0, 0, 5.51, 10.73),
                ("C", 5.51, 10.66, 5.50, 10.58, 5.50, 10.50),
                ("A", 4.99, 4.99, 0, 0, 1, 8.00, 6.17),
                ("A", 4.97, 4.97, 0, 0, 0, 5.50, 5.50),
                ("z",), ],
            "颜色31": [
                ("M", 10.50, 5.50),
                ("A", 5.00, 5.00, 0, 0, 0, 5.50, 10.50),
                ("C", 5.50, 10.58, 5.51, 10.66, 5.51, 10.73),
                ("A", 5.00, 5.00, 0, 0, 0, 13.00, 6.40),
                ("C", 13.00, 6.32, 12.99, 6.25, 12.99, 6.17),
                ("A", 4.97, 4.97, 0, 0, 0, 10.50, 5.50),
                ("z",), ],
            "颜色23": [
                ("M", 5.51, 10.73),
                ("A", 5.00, 5.00, 0, 0, 0, 8.00, 14.83),
                ("A", 4.99, 4.99, 0, 0, 0, 10.49, 10.74),
                ("A", 4.98, 4.98, 0, 0, 1, 8.00, 11.40),
                ("A", 4.97, 4.97, 0, 0, 1, 5.51, 10.73),
                ("z",), ],
            "颜色123": [
                ("M", 8.00, 6.17),
                ("A", 4.99, 4.99, 0, 0, 0, 5.50, 10.50),
                ("C", 5.50, 10.58, 5.51, 10.66, 5.51, 10.73),
                ("A", 4.98, 4.98, 0, 0, 0, 10.49, 10.74),
                ("C", 10.49, 10.66, 10.50, 10.58, 10.50, 10.50),
                ("A", 4.99, 4.99, 0, 0, 0, 8.00, 6.17),
                ("z",), ],
        }

    def 创作(self):
        三原色路径 = self.构建颜色路径1()
        for 路径名 in 三原色路径.keys():
            颜色_ = getattr(self, 路径名)
            self.连线(路径点列表=三原色路径[路径名], 填充颜色=颜色_, 描边宽度=0)


if __name__ == '__main__':
    神笔 = 三原色绘图板(作品文件路径="红黄蓝三原色.svg", 颜色1="red", 颜色2="yellow", 颜色3="blue",
                颜色12="orange", 颜色23="purple", 颜色31="green", 颜色123="black")
    神笔.完成()
